/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package SimpleQM.impl;

import helper.Helper;
import SimpleQM.QElement;
import SimpleQM.QoS;
import SimpleQM.QoS_availability;
import SimpleQM.QoS_latency;
import SimpleQM.QualitativeValue;
import SimpleQM.SimpleQMPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Qo Savailability</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link SimpleQM.impl.QoS_availabilityImpl#getQValue <em>QValue</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class QoS_availabilityImpl extends QoSCharacteristicImpl implements QoS_availability {
	/**
	 * The default value of the '{@link #getQValue() <em>QValue</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getQValue()
	 * @generated
	 * @ordered
	 */
	protected static final QualitativeValue QVALUE_EDEFAULT = QualitativeValue.LOW;

	/**
	 * The cached value of the '{@link #getQValue() <em>QValue</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getQValue()
	 * @generated
	 * @ordered
	 */
	protected QualitativeValue qValue = QVALUE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected QoS_availabilityImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return SimpleQMPackage.Literals.QO_SAVAILABILITY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public QualitativeValue getQValue() {
		return qValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setQValue(QualitativeValue newQValue) {
		QualitativeValue oldQValue = qValue;
		qValue = newQValue == null ? QVALUE_EDEFAULT : newQValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SimpleQMPackage.QO_SAVAILABILITY__QVALUE, oldQValue, qValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public QualitativeValue qValue(String qElement) {
		// TODO: implement this method
		// Ensure that you remove @generated or mark it @generated NOT
		throw new UnsupportedOperationException();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case SimpleQMPackage.QO_SAVAILABILITY__QVALUE:
				return getQValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case SimpleQMPackage.QO_SAVAILABILITY__QVALUE:
				setQValue((QualitativeValue)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case SimpleQMPackage.QO_SAVAILABILITY__QVALUE:
				setQValue(QVALUE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case SimpleQMPackage.QO_SAVAILABILITY__QVALUE:
				return qValue != QVALUE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (qValue: ");
		result.append(qValue);
		result.append(')');
		return result.toString();
	}

} //QoS_availabilityImpl
